<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>浏览足迹 - 人才职业生涯规划平台</title>
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <style>
        :root {
            --history-bg-color: #f8f9fa;
            --history-card-bg: #ffffff;
            --history-text-primary: #212529;
            --history-text-secondary: #6c757d;
            --history-border-color: #dee2e6;
            --history-soft-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
            --history-radius-lg: 16px;
            --history-radius-md: 12px;
            --history-radius-sm: 8px;
            --history-primary-color: #4a6fee;
        }
        
        body {
            background-color: var(--history-bg-color);
        }
        
        .app-container {
            max-width: var(--content-max-width, 450px);
            background-color: var(--history-bg-color);
            box-shadow: none;
        }
        
        /* 头部样式 */
        .history-header {
            position: fixed;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 100%;
            max-width: var(--content-max-width, 450px);
            background-color: white;
            display: flex;
            align-items: center;
            padding: 15px;
            z-index: 100;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        }
        
        .back-btn {
            background: none;
            border: none;
            font-size: 22px;
            color: var(--history-text-primary);
            cursor: pointer;
            padding: 0;
            margin-right: 15px;
        }
        
        .history-title {
            font-size: 18px;
            font-weight: 600;
            margin: 0;
        }
        
        .clear-history {
            margin-left: auto;
            background: none;
            border: none;
            color: var(--history-text-secondary);
            font-size: 14px;
            display: flex;
            align-items: center;
            cursor: pointer;
        }
        
        .clear-history i {
            margin-right: 4px;
        }
        
        /* 筛选分类样式 */
        .history-filters {
            margin-top: 60px;
            padding: 15px;
            overflow-x: auto;
            white-space: nowrap;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
            position: sticky;
            top: 60px;
            background-color: var(--history-bg-color);
            z-index: 99;
            border-bottom: 1px solid var(--history-border-color);
        }
        
        .history-filters::-webkit-scrollbar {
            display: none;
        }
        
        .filter-chip {
            display: inline-block;
            padding: 8px 15px;
            margin-right: 10px;
            background-color: white;
            border: 1px solid var(--history-border-color);
            border-radius: 20px;
            font-size: 14px;
            color: var(--history-text-secondary);
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .filter-chip.active {
            background-color: var(--history-primary-color);
            color: white;
            border-color: var(--history-primary-color);
        }
        
        /* 内容区域样式 */
        .history-content {
            padding: 15px;
            margin-top: 10px;
            padding-bottom: 70px; /* 为底部导航栏预留空间 */
        }
        
        .history-date {
            font-size: 14px;
            color: var(--history-text-secondary);
            margin: 20px 0 10px;
            padding-bottom: 8px;
            border-bottom: 1px dashed var(--history-border-color);
        }
        
        .history-item {
            background-color: var(--history-card-bg);
            border-radius: var(--history-radius-md);
            padding: 15px;
            margin-bottom: 15px;
            display: flex;
            box-shadow: var(--history-soft-shadow);
            transition: transform 0.2s ease;
            position: relative;
        }
        
        .history-item:hover, .history-item:active {
            transform: translateY(-2px);
        }
        
        .history-item-image {
            width: 80px;
            height: 80px;
            border-radius: var(--history-radius-sm);
            object-fit: cover;
            margin-right: 15px;
            flex-shrink: 0;
        }
        
        .history-item-content {
            flex-grow: 1;
            min-width: 0;
        }
        
        .history-item-title {
            font-size: 16px;
            font-weight: 600;
            color: var(--history-text-primary);
            margin: 0 0 5px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        
        .history-item-details {
            font-size: 14px;
            color: var(--history-text-secondary);
            margin: 0 0 8px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
        }
        
        .history-item-meta {
            display: flex;
            align-items: center;
            font-size: 12px;
            color: var(--history-text-secondary);
        }
        
        .history-item-time {
            margin-right: 15px;
            display: flex;
            align-items: center;
        }
        
        .history-item-time i, .history-item-category i {
            margin-right: 4px;
            font-size: 13px;
        }
        
        .history-item-category {
            display: flex;
            align-items: center;
        }
        
        .history-item-tag {
            position: absolute;
            top: 10px;
            right: 10px;
            background-color: rgba(74, 111, 238, 0.1);
            color: var(--history-primary-color);
            padding: 2px 8px;
            border-radius: 4px;
            font-size: 12px;
        }
        
        /* 空状态提示 */
        .empty-history {
            text-align: center;
            padding: 50px 20px;
            color: var(--history-text-secondary);
        }
        
        .empty-history i {
            font-size: 50px;
            margin-bottom: 15px;
            opacity: 0.5;
        }
        
        .empty-history p {
            font-size: 15px;
            margin: 0;
        }
        
        /* 底部导航栏样式（复用profile.html样式） */
        .tab-bar {
            height: 50px; 
            position: fixed;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 100%;
            max-width: 450px;
            z-index: 1000;
            display: flex;
            justify-content: space-around;
            align-items: center;
            background-color: #fff;
            border-top: 1px solid #eee;
            box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.05);
            opacity: 1;
            transition: all 0.3s ease;
            padding-bottom: env(safe-area-inset-bottom, 0); 
        }
        
        .tab-bar .tab-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            flex: 1;
            height: 100%;
            color: #8e8e93;
            font-size: 10px;
            position: relative;
            text-decoration: none;
            padding: 0;
        }
        
        .tab-bar .tab-item.active {
            color: #4a6fee;
        }
        
        .tab-bar .tab-item i {
            font-size: 20px;
            margin-bottom: 2px;
            transition: all 0.3s ease;
        }
        
        .tab-bar .tab-item span {
            font-size: 10px;
            line-height: 1;
            transition: all 0.3s ease;
        }
        
        .tab-bar .tab-item.active::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 16px;
            height: 2px;
            border-radius: 1px;
            background-color: #4a6fee;
        }
        
        /* 针对iPhoneX等全面屏设备的安全区适配 */
        @supports (padding-bottom: constant(safe-area-inset-bottom)) {
            .tab-bar {
                padding-bottom: constant(safe-area-inset-bottom);
            }
            .history-content {
                padding-bottom: calc(50px + constant(safe-area-inset-bottom));
            }
        }
        
        @supports (padding-bottom: env(safe-area-inset-bottom)) {
            .tab-bar {
                padding-bottom: env(safe-area-inset-bottom);
            }
            .history-content {
                padding-bottom: calc(50px + env(safe-area-inset-bottom));
            }
        }
    </style>
</head>
<body>
    <div class="app-container">
        <!-- 头部导航 -->
        <header class="history-header">
            <button class="back-btn" onclick="history.back()">
                <i class="bi bi-chevron-left"></i>
            </button>
            <h1 class="history-title">浏览足迹</h1>
            <button class="clear-history">
                <i class="bi bi-trash3"></i>
                清空
            </button>
        </header>

        <!-- 筛选分类 -->
        <div class="history-filters">
            <div class="filter-chip active" data-category="all">全部</div>
            <div class="filter-chip" data-category="job">职位</div>
            <div class="filter-chip" data-category="company">公司</div>
            <div class="filter-chip" data-category="article">文章</div>
            <div class="filter-chip" data-category="video">视频</div>
            <div class="filter-chip" data-category="agent">经纪人</div>
        </div>

        <!-- 主内容区 -->
        <main class="history-content">
            <!-- 今天 -->
            <div class="history-date">今天</div>
            
            <div class="history-item" data-category="job">
                <img src="../img/company-1.jpg" alt="公司LOGO" class="history-item-image">
                <div class="history-item-content">
                    <h3 class="history-item-title">前端开发工程师（P6/P7）</h3>
                    <p class="history-item-details">阿里巴巴 · 北京 · 20-40K · 本科及以上</p>
                    <div class="history-item-meta">
                        <div class="history-item-time">
                            <i class="bi bi-clock"></i>
                            <span>10:30</span>
                        </div>
                        <div class="history-item-category">
                            <i class="bi bi-briefcase"></i>
                            <span>职位</span>
                        </div>
                    </div>
                </div>
                <div class="history-item-tag">热门</div>
            </div>
            
            <div class="history-item" data-category="agent">
                <img src="../img/agent-1.jpg" alt="经纪人头像" class="history-item-image">
                <div class="history-item-content">
                    <h3 class="history-item-title">王经理</h3>
                    <p class="history-item-details">资深互联网招聘顾问 · 5年经验 · 擅长大厂内推，简历深度优化</p>
                    <div class="history-item-meta">
                        <div class="history-item-time">
                            <i class="bi bi-clock"></i>
                            <span>09:45</span>
                        </div>
                        <div class="history-item-category">
                            <i class="bi bi-person-rolodex"></i>
                            <span>经纪人</span>
                        </div>
                    </div>
                </div>
                <div class="history-item-tag">匹配度98%</div>
            </div>

            <!-- 昨天 -->
            <div class="history-date">昨天</div>
            
            <div class="history-item" data-category="company">
                <img src="../img/company-2.jpg" alt="公司LOGO" class="history-item-image">
                <div class="history-item-content">
                    <h3 class="history-item-title">腾讯科技</h3>
                    <p class="history-item-details">互联网 · 10000人以上 · 已上市 · A轮融资</p>
                    <div class="history-item-meta">
                        <div class="history-item-time">
                            <i class="bi bi-clock"></i>
                            <span>16:20</span>
                        </div>
                        <div class="history-item-category">
                            <i class="bi bi-building"></i>
                            <span>公司</span>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="history-item" data-category="article">
                <img src="../img/article-1.jpg" alt="文章配图" class="history-item-image">
                <div class="history-item-content">
                    <h3 class="history-item-title">10个常见的面试问题及回答技巧</h3>
                    <p class="history-item-details">本文整理了技术岗最常见的面试问题及高分回答要点，助你一臂之力...</p>
                    <div class="history-item-meta">
                        <div class="history-item-time">
                            <i class="bi bi-clock"></i>
                            <span>14:05</span>
                        </div>
                        <div class="history-item-category">
                            <i class="bi bi-journal-text"></i>
                            <span>文章</span>
                        </div>
                    </div>
                </div>
                <div class="history-item-tag">精选</div>
            </div>

            <!-- 更早 -->
            <div class="history-date">更早</div>
            
            <div class="history-item" data-category="video">
                <img src="../img/video-1.jpg" alt="视频封面" class="history-item-image">
                <div class="history-item-content">
                    <h3 class="history-item-title">如何准备字节跳动技术面试</h3>
                    <p class="history-item-details">前字节面试官分享面试经验和技巧，深入剖析算法考点...</p>
                    <div class="history-item-meta">
                        <div class="history-item-time">
                            <i class="bi bi-clock"></i>
                            <span>09/25</span>
                        </div>
                        <div class="history-item-category">
                            <i class="bi bi-play-circle"></i>
                            <span>视频</span>
                        </div>
                    </div>
                </div>
                <div class="history-item-tag">收藏最多</div>
            </div>
            
            <div class="history-item" data-category="job">
                <img src="../img/company-3.jpg" alt="公司LOGO" class="history-item-image">
                <div class="history-item-content">
                    <h3 class="history-item-title">Java高级开发工程师</h3>
                    <p class="history-item-details">字节跳动 · 上海 · 30-60K · 经验3年以上</p>
                    <div class="history-item-meta">
                        <div class="history-item-time">
                            <i class="bi bi-clock"></i>
                            <span>09/24</span>
                        </div>
                        <div class="history-item-category">
                            <i class="bi bi-briefcase"></i>
                            <span>职位</span>
                        </div>
                    </div>
                </div>
            </div>
        </main>

        <!-- 底部导航栏 -->
        <footer class="tab-bar">
            <a href="../index.html" class="tab-item">
                <i class="bi bi-house-door"></i>
                <span>首页</span>
            </a>
            <a href="discover.html" class="tab-item">
                <i class="bi bi-compass"></i>
                <span>发现</span>
            </a>
            <a href="agents.html" class="tab-item">
                <i class="bi bi-person-rolodex"></i>
                <span>经纪人</span>
            </a>
            <a href="profile.html" class="tab-item active">
                <i class="bi bi-person-fill"></i>
                <span>我的</span>
            </a>
        </footer>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 筛选分类功能
            const filterChips = document.querySelectorAll('.filter-chip');
            const historyItems = document.querySelectorAll('.history-item');
            
            // 设置筛选点击事件
            filterChips.forEach(chip => {
                chip.addEventListener('click', function() {
                    // 移除所有活跃状态
                    filterChips.forEach(c => c.classList.remove('active'));
                    // 添加当前活跃状态
                    this.classList.add('active');
                    
                    const category = this.dataset.category;
                    
                    // 筛选显示相应类别
                    historyItems.forEach(item => {
                        if (category === 'all' || item.dataset.category === category) {
                            item.style.display = 'flex';
                        } else {
                            item.style.display = 'none';
                        }
                    });
                    
                    // 检查筛选后是否有内容，如果没有显示空状态
                    checkEmptyState(category);
                });
            });
            
            // 检查空状态并显示提示
            function checkEmptyState(category) {
                let hasVisibleItems = false;
                historyItems.forEach(item => {
                    if (item.style.display !== 'none') {
                        hasVisibleItems = true;
                    }
                });
                
                // 移除已存在的空状态提示
                const existingEmptyState = document.querySelector('.empty-history');
                if (existingEmptyState) {
                    existingEmptyState.remove();
                }
                
                // 如果没有可见项目，添加空状态提示
                if (!hasVisibleItems) {
                    const emptyState = document.createElement('div');
                    emptyState.className = 'empty-history';
                    emptyState.innerHTML = `
                        <i class="bi bi-clock-history"></i>
                        <p>暂无${getCategoryName(category)}浏览记录</p>
                    `;
                    document.querySelector('.history-content').appendChild(emptyState);
                }
            }
            
            // 获取分类名称
            function getCategoryName(category) {
                const categoryNames = {
                    'all': '',
                    'job': '职位',
                    'company': '公司',
                    'article': '文章',
                    'video': '视频',
                    'agent': '经纪人'
                };
                return categoryNames[category] || '';
            }
            
            // 清空浏览记录功能
            const clearBtn = document.querySelector('.clear-history');
            clearBtn.addEventListener('click', function() {
                if (confirm('确定要清空所有浏览记录吗？')) {
                    historyItems.forEach(item => {
                        item.style.display = 'none';
                    });
                    
                    // 显示全部为空的状态
                    const emptyState = document.createElement('div');
                    emptyState.className = 'empty-history';
                    emptyState.innerHTML = `
                        <i class="bi bi-clock-history"></i>
                        <p>暂无浏览记录</p>
                    `;
                    document.querySelector('.history-content').appendChild(emptyState);
                    
                    // 日期标题也隐藏
                    document.querySelectorAll('.history-date').forEach(date => {
                        date.style.display = 'none';
                    });
                }
            });
            
            // 点击历史记录项跳转相应页面
            historyItems.forEach(item => {
                item.addEventListener('click', function() {
                    const category = this.dataset.category;
                    // 根据不同类别跳转到不同页面
                    // 实际项目中可以根据ID跳转到具体详情页
                    switch(category) {
                        case 'job':
                            // window.location.href = `job-detail.html?id=${this.dataset.id}`;
                            alert('跳转到职位详情页');
                            break;
                        case 'company':
                            // window.location.href = `company-detail.html?id=${this.dataset.id}`;
                            alert('跳转到公司详情页');
                            break;
                        case 'article':
                            // window.location.href = `article-detail.html?id=${this.dataset.id}`;
                            alert('跳转到文章详情页');
                            break;
                        case 'video':
                            // window.location.href = `video-detail.html?id=${this.dataset.id}`;
                            alert('跳转到视频详情页');
                            break;
                        case 'agent':
                            // window.location.href = `agent-detail.html?id=${this.dataset.id}`;
                            alert('跳转到经纪人详情页');
                            break;
                    }
                });
            });
        });
    </script>
</body>
</html> 